﻿<UserControl x:Class="LightReader.MainPage" 
             xmlns="http://schemas.microsoft.com/client/2007"  
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
             xmlns:lr="clr-namespace:LightReader;assembly=LightReader"
             xmlns:my="clr-namespace:LightReader.ControlLibrary;assembly=LightReader"
             xmlns:Controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
             >
				
	<Grid x:Name="LayoutRoot"> 
		<Image x:Name="backgroundImage" Source="silverlight_2.jpg" Stretch="Fill" />
				 
	    <Grid x:Name="LayoutGrid" ShowGridLines="False" HorizontalAlignment="Stretch">	
						
	        <Grid.RowDefinitions>
	            <RowDefinition Height="15"/>
	            <RowDefinition Height="35"/>
	            <RowDefinition Height="35"/>
	            <RowDefinition Height="*"/>
	            <RowDefinition Height="10"/>
	        </Grid.RowDefinitions>
	        
	        <Grid.ColumnDefinitions>
	            <ColumnDefinition Width="10"/>
				<ColumnDefinition Width="200"/>
	             <ColumnDefinition Width="*"/>
	            <ColumnDefinition Width="10"/>
	        </Grid.ColumnDefinitions>
	        
			<StackPanel Grid.Row="0" Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right">
				<HyperlinkButton x:Name="importOPMLButton"
					Content="Import OPML"	                
					Margin="0,0,10,0" Foreground="{StaticResource linkButtonColor}"/>	
			
				<HyperlinkButton x:Name="myProfileButton"
					Content="My Profile"
					Margin="0,0,10,0" Foreground="{StaticResource linkButtonColor}"/>
					
		        <HyperlinkButton x:Name="logoutButton" 
		            Content="Logout" 
		            HorizontalAlignment="Right" 
		            VerticalAlignment="Center"
		            Margin="0,0,10,0" Foreground="{StaticResource linkButtonColor}"/>
			</StackPanel>	                   					
						
	        <Border Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" CornerRadius="10" Background="{StaticResource headerBackground}" Margin="2">
                <StackPanel Orientation="Horizontal">
	                <TextBlock x:Name="blogTitle" 
	                           Text="LightReader" 
	                           Foreground="White" 
	                           Margin="10,5,0,0"/>
                    
                    <HyperlinkButton 
                        x:Name="blogHyperlinkButton"
                        Foreground="White"
                        Visibility="Collapsed"
                        FontSize="16"
                        Margin="10,5,0,0"
                        />                    
                </StackPanel>                    
	        </Border>
		                            
			<Border 
				Grid.Column="1" Grid.Row="3" 
				CornerRadius="10" 
				Margin="0,0,5,0"
				Background="{StaticResource panelBackground}">
				
				<StackPanel  Orientation="Vertical" x:Name="feedList">
					<StackPanel Orientation="Horizontal">
						<HyperlinkButton x:Name="subscribeToFeedButton" Content="Subscribe" Foreground="{StaticResource linkButtonColor}" Margin="10,5,0,0" HorizontalAlignment="Left" />
						<HyperlinkButton x:Name="refreshFeedsButton" Content="Refresh All Feeds" Foreground="{StaticResource linkButtonColor}" Margin="30,5,0,0" HorizontalAlignment="Right" Visibility="Collapsed"/>
					</StackPanel>
					
				    <ListBox x:Name="subscribedFeedsList" Height="500" Margin="5,5,5,5" />
				</StackPanel>
			</Border>
				
			<Border 
				Grid.Row="3" Grid.Column="2" 
				CornerRadius="10" 
				Margin="5,0,0,0"
				Background="{StaticResource panelBackground}">
				
				<StackPanel Orientation="Vertical">
							
    				<HyperlinkButton 
                        x:Name="unsubscribeFromFeedButton" 
                        Content="Unsubscribe" 
                        Foreground="{StaticResource linkButtonColor}" 
                        Margin="5,5,0,0"                        
                        />
				
	                <ScrollViewer 
	                    HorizontalAlignment="Stretch"
	                    VerticalAlignment="Stretch"
	                    HorizontalScrollBarVisibility="Auto" 
	                    VerticalScrollBarVisibility="Auto">

                        <Controls:DataGrid x:Name="postGrid" 
                            AutoGenerateColumns="False"
                            HeadersVisibility="Column"
			                RowHeight="25" 
                                           IsReadOnly="True" Margin="5"			                			                
			                SelectionMode="Single"
                                           Height="Auto"                    
						    >

                            <Controls:DataGrid.Columns>
                                <Controls:DataGridTemplateColumn Header="Title" Width="400">
                                    <Controls:DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <HyperlinkButton
                                                Content="{Binding Name}"
                                                NavigateUri="{Binding Url}"
                                                TargetName="_blank"
                                                Margin="10,5,0,0"
                                                />
                                        </DataTemplate>
                                    </Controls:DataGridTemplateColumn.CellTemplate>
                                </Controls:DataGridTemplateColumn>

                                <Controls:DataGridTextColumn Header="Date" Binding="{Binding PublishDate}" Width="200"/>
                            </Controls:DataGrid.Columns>

                        </Controls:DataGrid>

                    </ScrollViewer>
				</StackPanel>
			</Border>
	        <Popup x:Name="subscribePopup">
	            <lr:Subscribe x:Name="subscribeForm" />
	        </Popup>
	    </Grid>
	</Grid>
</UserControl>
